package com.example.home.adapter

import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.example.entity.BaseEntity
import com.example.home.adapter.provider.FollowCardProvider
import com.example.home.adapter.provider.SingleTitleProvider
import com.example.home.entity.viewdata.FollowCardViewData
import com.example.home.entity.viewdata.SingleTitleViewData
import com.example.home.entity.viewdata.TitleCardViewData
import com.example.home.entity.viewdata.VideoCardViewData


/**
 * 每日视频列表适配器
 * */
class DailyListAdapter : BaseProviderMultiAdapter<BaseEntity>() {

    init {
        addItemProvider(FollowCardProvider())
        addItemProvider(SingleTitleProvider())
    }

    override fun getItemType(data: List<BaseEntity>, position: Int): Int {
        var entity= data[position]

        return when(entity){
            is FollowCardViewData -> NominateItemType.FOLLOW_CARD_VIEW
            is SingleTitleViewData -> NominateItemType.SINGLE_TITLE_VIEW
            else -> NominateItemType.DEFAULT_VIEW
        }
    }
}